//
//  Sr1ViewController.swift
//  edu
//
//  Created by karlzhou on 15/11/5.
//  Copyright © 2015年 karlzhou. All rights reserved.
//

import UIKit

class Sr1ViewController: UITableViewController {
    let identifier="cellId"
   let data=["0","1","2","3","4","5","6","7","8","9"]
    override func viewDidLoad() {
        super.viewDidLoad()

        self.tableView=UITableView(frame: self.view.bounds, style: UITableViewStyle.Plain)
       //self.tableView.registerClass(<#T##cellClass: AnyClass?##AnyClass?#>, forCellReuseIdentifier: <#T##String#>)
        self.tableView.registerClass(UITableViewCell.self, forCellReuseIdentifier: identifier)
        
    }

    override func didReceiveMemoryWarning() {
        super.didReceiveMemoryWarning()
        // Dispose of any resources that can be recreated.
    }
    
    
    @available(iOS 2.0, *)
     override func tableView(tableView: UITableView, numberOfRowsInSection section: Int) -> Int{
        return 10
    }
  
    
    @available(iOS 2.0, *)
    override func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{
        let cell=tableView.dequeueReusableCellWithIdentifier(identifier, forIndexPath: indexPath)
        cell.textLabel?.text="\(data[indexPath.row])"
        cell.backgroundColor=UIColor.blueColor()
        return cell;
    }
    
    // Default is 1 if not implemented
    @available(iOS 2.0, *)
    override func numberOfSectionsInTableView(tableView: UITableView) -> Int{
        return 1
    }

    
    override func tableView(tableView: UITableView, didDeselectRowAtIndexPath indexPath: NSIndexPath) {
   

       let sr2VC = Sr2ViewController()
        //self.delegate=sr2VC;
        
        //[self.delegate passValue:"test"];
       sr2VC.title =  "\(data[indexPath.row])"
        sr2VC.view.backgroundColor=UIColor.whiteColor()
        self.presentViewController(sr2VC, animated: true, completion: {
            () -> Void in
            print("jump")
        })
        
    }

}
